package aiP.A3.Client;

import aiP.A3.Client.Dispatcher.Dispatcher;
import aiP.A3.Client.Dispatcher.IDispatcher;
import aiP.A3.Client.Monitor.Monitor;
import aiP.A3.MPS.Interfaces.IServerInstance;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

/**
 * Created with IntelliJ IDEA.
 * User: Hero
 * Date: 28.05.14
 * Time: 12:25
 * To change this template use File | Settings | File Templates.
 */
public class ClientStarter extends Thread{
    public static void main(String[] args) {
        try{
            Registry registry = LocateRegistry.createRegistry(1173);
            System.out.println("vor monitor");
            Monitor monitor = new Monitor();
            System.out.println("nach monitor");
            System.out.println("vor dispatcher");
            IDispatcher dispatcher = new Dispatcher(monitor);
            registry.rebind("MPS", UnicastRemoteObject.exportObject(dispatcher, 0));
            System.out.println("nach Dispatcher rebind");
            Thread.sleep(3000000);
            System.out.println("blub nachher");

        } catch(Exception e){
            e.printStackTrace();
        }
    }
}
